package com.atguigu.eduservice.controller;


import com.atguigu.commonutils.CommonResult;
import com.atguigu.eduservice.entity.CrmBanner;
import com.atguigu.eduservice.service.CrmBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author 李红磊
 * @since 2021-06-23
 */
@RestController
@RequestMapping("/educms/banner")
@CrossOrigin
public class BannerFrontController {

    @Autowired
    private CrmBannerService crmBannerService;

    //查询所有banner
    @Cacheable(key = "'selectIndexList'",value = "banner")
    @GetMapping("getAllBanner")
    public CommonResult getAllBanner(){
        System.out.println("请求打进来getAllBanner");
        List<CrmBanner> List =crmBannerService.selectAllBanner();
        return CommonResult.ok().data("list",List);
    }

}

